/**
 * 
 */
package domain;

/**
 * @author it-equipment-selection team
 *
 */
public class Server extends Product {
	
	private String processor;
	private int memory;
	private int discsNumber;
	private boolean debianComp;

	public Server(String brand, String model, double price, Article article,
			Supplier supplier, String processor, int memory, int discsNumber,
			boolean debianComp) {
		super(brand, model, price, article, supplier);
		this.processor = processor;
		this.memory = memory;
		this.discsNumber = discsNumber;
		this.debianComp = debianComp;
	}
	
	public Server(String brand, String model, double price, Article article,
			Supplier supplier) {
		super(brand, model, price, article, supplier);
	}
	
	public String getProcessor() {
		return processor;
	}

	public void setProcessor(String processor) {
		this.processor = processor;
	}

	public int getMemory() {
		return memory;
	}

	public void setMemory(int memory) {
		this.memory = memory;
	}

	public int getDiscsNumber() {
		return discsNumber;
	}

	public void setDiscsNumber(int discsNumber) {
		this.discsNumber = discsNumber;
	}

	public boolean isDebianComp() {
		return debianComp;
	}

	public void setDebianComp(boolean debianComp) {
		this.debianComp = debianComp;
	}

	/* (non-Javadoc)
	 * @see domain.Product#doValidate()
	 */
	public void doValidate() {
		if (memory > 2048 && discsNumber > 2 && debianComp){
			super.setValid(true);
		} else {
			super.setValid(false);
		}
		super.setValidate(true);
	}
	
	public void doContract() {
		if (this.isValid()){
			super.setContracted(true);
		}		
	}

}
